Integrand size = 28, antiderivative size = 479 \[ \int \frac {(e+f x)^2 \sin ^2(c+d x)}{a+b \sin (c+d x)} \, dx=-\frac {a (e+f x)^3}{3 b^2 f}+\frac {2 f^2 \cos (c+d x)}{b d^3}-\frac {(e+f x)^2 \cos (c+d x)}{b d}-\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}+\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}-\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^2}+\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^2}-\frac {2 i a^2 f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^3}+\frac {2 i a^2 f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^3}+\frac {2 f (e+f x) \sin (c+d x)}{b d^2} \]
[Out]
Time = 0.67 (sec) , antiderivative size = 479, normalized size of antiderivative = 1.00, number of steps used = 16, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.357, Rules used = {4611, 3377, 2718, 32, 3404, 2296, 2221, 2611, 2320, 6724} \[ \int \frac {(e+f x)^2 \sin ^2(c+d x)}{a+b \sin (c+d x)} \, dx=-\frac {2 i a^2 f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 d^3 \sqrt {a^2-b^2}}+\frac {2 i a^2 f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 d^3 \sqrt {a^2-b^2}}-\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 d^2 \sqrt {a^2-b^2}}+\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 d^2 \sqrt {a^2-b^2}}-\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 d \sqrt {a^2-b^2}}+\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{b^2 d \sqrt {a^2-b^2}}-\frac {a (e+f x)^3}{3 b^2 f}+\frac {2 f^2 \cos (c+d x)}{b d^3}+\frac {2 f (e+f x) \sin (c+d x)}{b d^2}-\frac {(e+f x)^2 \cos (c+d x)}{b d} \]
[In]
[Out]
Rule 32
Rule 2221
Rule 2296
Rule 2320
Rule 2611
Rule 2718
Rule 3377
Rule 3404
Rule 4611
Rule 6724
Rubi steps \begin{align*} \text {integral}& = \frac {\int (e+f x)^2 \sin (c+d x) \, dx}{b}-\frac {a \int \frac {(e+f x)^2 \sin (c+d x)}{a+b \sin (c+d x)} \, dx}{b} \\ & = -\frac {(e+f x)^2 \cos (c+d x)}{b d}-\frac {a \int (e+f x)^2 \, dx}{b^2}+\frac {a^2 \int \frac {(e+f x)^2}{a+b \sin (c+d x)} \, dx}{b^2}+\frac {(2 f) \int (e+f x) \cos (c+d x) \, dx}{b d} \\ & = -\frac {a (e+f x)^3}{3 b^2 f}-\frac {(e+f x)^2 \cos (c+d x)}{b d}+\frac {2 f (e+f x) \sin (c+d x)}{b d^2}+\frac {\left (2 a^2\right ) \int \frac {e^{i (c+d x)} (e+f x)^2}{i b+2 a e^{i (c+d x)}-i b e^{2 i (c+d x)}} \, dx}{b^2}-\frac {\left (2 f^2\right ) \int \sin (c+d x) \, dx}{b d^2} \\ & = -\frac {a (e+f x)^3}{3 b^2 f}+\frac {2 f^2 \cos (c+d x)}{b d^3}-\frac {(e+f x)^2 \cos (c+d x)}{b d}+\frac {2 f (e+f x) \sin (c+d x)}{b d^2}-\frac {\left (2 i a^2\right ) \int \frac {e^{i (c+d x)} (e+f x)^2}{2 a-2 \sqrt {a^2-b^2}-2 i b e^{i (c+d x)}} \, dx}{b \sqrt {a^2-b^2}}+\frac {\left (2 i a^2\right ) \int \frac {e^{i (c+d x)} (e+f x)^2}{2 a+2 \sqrt {a^2-b^2}-2 i b e^{i (c+d x)}} \, dx}{b \sqrt {a^2-b^2}} \\ & = -\frac {a (e+f x)^3}{3 b^2 f}+\frac {2 f^2 \cos (c+d x)}{b d^3}-\frac {(e+f x)^2 \cos (c+d x)}{b d}-\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}+\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}+\frac {2 f (e+f x) \sin (c+d x)}{b d^2}+\frac {\left (2 i a^2 f\right ) \int (e+f x) \log \left (1-\frac {2 i b e^{i (c+d x)}}{2 a-2 \sqrt {a^2-b^2}}\right ) \, dx}{b^2 \sqrt {a^2-b^2} d}-\frac {\left (2 i a^2 f\right ) \int (e+f x) \log \left (1-\frac {2 i b e^{i (c+d x)}}{2 a+2 \sqrt {a^2-b^2}}\right ) \, dx}{b^2 \sqrt {a^2-b^2} d} \\ & = -\frac {a (e+f x)^3}{3 b^2 f}+\frac {2 f^2 \cos (c+d x)}{b d^3}-\frac {(e+f x)^2 \cos (c+d x)}{b d}-\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}+\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}-\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^2}+\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^2}+\frac {2 f (e+f x) \sin (c+d x)}{b d^2}+\frac {\left (2 a^2 f^2\right ) \int \operatorname {PolyLog}\left (2,\frac {2 i b e^{i (c+d x)}}{2 a-2 \sqrt {a^2-b^2}}\right ) \, dx}{b^2 \sqrt {a^2-b^2} d^2}-\frac {\left (2 a^2 f^2\right ) \int \operatorname {PolyLog}\left (2,\frac {2 i b e^{i (c+d x)}}{2 a+2 \sqrt {a^2-b^2}}\right ) \, dx}{b^2 \sqrt {a^2-b^2} d^2} \\ & = -\frac {a (e+f x)^3}{3 b^2 f}+\frac {2 f^2 \cos (c+d x)}{b d^3}-\frac {(e+f x)^2 \cos (c+d x)}{b d}-\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}+\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}-\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^2}+\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^2}+\frac {2 f (e+f x) \sin (c+d x)}{b d^2}-\frac {\left (2 i a^2 f^2\right ) \text {Subst}\left (\int \frac {\operatorname {PolyLog}\left (2,\frac {i b x}{a-\sqrt {a^2-b^2}}\right )}{x} \, dx,x,e^{i (c+d x)}\right )}{b^2 \sqrt {a^2-b^2} d^3}+\frac {\left (2 i a^2 f^2\right ) \text {Subst}\left (\int \frac {\operatorname {PolyLog}\left (2,\frac {i b x}{a+\sqrt {a^2-b^2}}\right )}{x} \, dx,x,e^{i (c+d x)}\right )}{b^2 \sqrt {a^2-b^2} d^3} \\ & = -\frac {a (e+f x)^3}{3 b^2 f}+\frac {2 f^2 \cos (c+d x)}{b d^3}-\frac {(e+f x)^2 \cos (c+d x)}{b d}-\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}+\frac {i a^2 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d}-\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^2}+\frac {2 a^2 f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^2}-\frac {2 i a^2 f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^3}+\frac {2 i a^2 f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} d^3}+\frac {2 f (e+f x) \sin (c+d x)}{b d^2} \\ \end{align*}
Time = 2.36 (sec) , antiderivative size = 531, normalized size of antiderivative = 1.11 \[ \int \frac {(e+f x)^2 \sin ^2(c+d x)}{a+b \sin (c+d x)} \, dx=\frac {-a x \left (3 e^2+3 e f x+f^2 x^2\right )+\frac {3 i a^2 \left (-2 \sqrt {a^2-b^2} d f (e+f x) \operatorname {PolyLog}\left (2,\frac {b e^{i (c+d x)}}{-i a+\sqrt {-a^2+b^2}}\right )+2 \sqrt {a^2-b^2} d f (e+f x) \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{i a+\sqrt {-a^2+b^2}}\right )-i \left (d^2 \left (2 \sqrt {-a^2+b^2} e^2 \arctan \left (\frac {i a+b e^{i (c+d x)}}{\sqrt {a^2-b^2}}\right )+\sqrt {a^2-b^2} f x (2 e+f x) \left (\log \left (1-\frac {b e^{i (c+d x)}}{-i a+\sqrt {-a^2+b^2}}\right )-\log \left (1+\frac {b e^{i (c+d x)}}{i a+\sqrt {-a^2+b^2}}\right )\right )\right )+2 \sqrt {a^2-b^2} f^2 \operatorname {PolyLog}\left (3,\frac {b e^{i (c+d x)}}{-i a+\sqrt {-a^2+b^2}}\right )-2 \sqrt {a^2-b^2} f^2 \operatorname {PolyLog}\left (3,-\frac {b e^{i (c+d x)}}{i a+\sqrt {-a^2+b^2}}\right )\right )\right )}{\sqrt {-\left (a^2-b^2\right )^2} d^3}-\frac {3 b \cos (d x) \left (\left (-2 f^2+d^2 (e+f x)^2\right ) \cos (c)-2 d f (e+f x) \sin (c)\right )}{d^3}+\frac {3 b \left (2 d f (e+f x) \cos (c)+\left (-2 f^2+d^2 (e+f x)^2\right ) \sin (c)\right ) \sin (d x)}{d^3}}{3 b^2} \]
[In]
[Out]
\[\int \frac {\left (f x +e \right )^{2} \left (\sin ^{2}\left (d x +c \right )\right )}{a +b \sin \left (d x +c \right )}d x\]
[In]
[Out]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 1855 vs. \(2 (419) = 838\).
Time = 0.51 (sec) , antiderivative size = 1855, normalized size of antiderivative = 3.87 \[ \int \frac {(e+f x)^2 \sin ^2(c+d x)}{a+b \sin (c+d x)} \, dx=\text {Too large to display} \]
[In]
[Out]
Timed out. \[ \int \frac {(e+f x)^2 \sin ^2(c+d x)}{a+b \sin (c+d x)} \, dx=\text {Timed out} \]
[In]
[Out]
Exception generated. \[ \int \frac {(e+f x)^2 \sin ^2(c+d x)}{a+b \sin (c+d x)} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
\[ \int \frac {(e+f x)^2 \sin ^2(c+d x)}{a+b \sin (c+d x)} \, dx=\int { \frac {{\left (f x + e\right )}^{2} \sin \left (d x + c\right )^{2}}{b \sin \left (d x + c\right ) + a} \,d x } \]
[In]
[Out]
Timed out. \[ \int \frac {(e+f x)^2 \sin ^2(c+d x)}{a+b \sin (c+d x)} \, dx=\text {Hanged} \]
[In]
[Out]